package com.group.mall.mapper;

import com.group.mall.domain.POJO.Goods;
import com.group.mall.domain.POJO.GoodsPre;
import com.group.mall.domain.POJO.GoodsPro;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface GoodsMapper {
    List<Goods> selectGoodsByName(@Param("searchInfo") String searchInfo, @Param("chooseType") Integer chooseType);

    GoodsPre selectGoodsPreById(Integer id);

    @Select("select * from hmall.goods where goods_id = #{id}")
    Goods selectGoodsById(Integer id);

    List<Goods> selectHotGoods();

    List<Goods> selectGoods(String searchInfo);

    // 更新商品评分
    @Update("update hmall.goods set score = #{score} where goods_id = #{goodsId}")
    Boolean updateGoodsScore(@Param("goodsId") Integer goodsId, @Param("score") float score);

    GoodsPro selectGoodsProById(Integer id);

    @Select("select * from hmall.goods")
    List<Goods> selectAllGoods();
}
